#ifndef _HILINK_OTA_ADAPTOR_H
#define _HILINK_OTA_ADAPTOR_H

#include <stdbool.h>

/**
 * Restart Module after ota
 **/
extern void HalHilinkOtaAdapterRestart(int flag);

/**
 * Initialize the flash partition of the device, 
 * determine the location and length of the download, 
 * and other information
 **/
extern bool HalHilinkOtaAdapterFlashInit(void);

/**
 * Determine whether the partition upgrade is OK
 **/
extern bool HalHilinkOtaAdapterFlashFinish(void);

/**
 * Get the maximum length of the upgrade interval
 **/
extern unsigned int HalHilinkOtaAdapterFlashMaxSize(void);

/**
 * Determine the partition that needs to be upgraded
 **/
extern unsigned int HalHilinkOtaAdapterGetUpdateIndex(void);

/**
 * Erase the partition that needs to be upgraded
 **/
extern int HalHilinkOtaAdapterFlashErase(unsigned int size);

/**
 * Upgrade data writes to the upgraded partition
 **/
extern int HalHilinkOtaAdapterFlashWrite(const unsigned char *buf, unsigned int bufLen);

/**
 * Read upgrade partition data
 **/
extern int HalHilinkOtaAdapterFlashRead(unsigned int offset, unsigned char *buf, unsigned int bufLen);

#endif  // _HILINK_OTA_ADAPTOR_H